<template>
	<view style="position: relative;">

		<view class="home_page">
			<view v-show="PageCur!='my'" :style="'padding-top:'+(demo.height+demo.top+10)+'px'">
				<head1 class="nav_top"
					:style="'height:' +  demo.height + 'px;' + 'padding-top:' + demo.top + 'px;padding-bottom:10px'"
					:nav="title" :showBack="showBack">
				</head1>
			</view>

			<!-- 页脚导航 -->
			<home v-if="PageCur=='home'" ref="homeMethod"></home>
			<zhaopin1 v-if="PageCur=='zhaopin1'" ref="zhaopin1Method"></zhaopin1>
			<join v-if="PageCur=='join'" ref="joinMethod"></join>
			<server v-if="PageCur=='server'" ref="serverMethod"></server>
			<my v-if="PageCur=='my'" ref="myMethod"></my>
			<view class="cu-bar tabbar bg-white foot bar_main">
				<view class="action " :class="PageCur=='home'?'text-cyan':''" @click="NavChange" data-cur="home">
					<view class="cuIcon-cu-image">
						<image :src="PageCur=='home'?'/static/icon/home2.png':'/static/icon/home1.png'" mode="">
						</image>
					</view>首页
				</view>
				<view class="action " :class="PageCur=='zhaopin1'?'text-cyan':''" @click="NavChange"
					data-cur="zhaopin1">
					<view class="cuIcon-cu-image">
						<image :src="PageCur=='zhaopin1'?'/static/icon/zhaopin2.png':'/static/icon/zhaopin1.png'">
						</image>
					</view>招聘
				</view>
				<view class="action  add-action" :class="PageCur=='server'?'text-cyan':''" @click="NavChange"
					data-cur="join">
					<view class="cu-btn cuIcon-cu-image bg-cyan shadow">
						<image :src="PageCur=='join'?'/static/icon/add2.png':'/static/icon/add1.png'"
							style="width: 100%;height: 100%;"></image>
					</view>
				</view>
				<view class="action " :class="PageCur=='server'?'text-cyan':''" @click="NavChange" data-cur="server">
					<view class="cuIcon-cu-image">
						<image :src="PageCur=='server'?'/static/icon/fuwu2.png':'/static/icon/fuwu1.png'"></image>
					</view>
					服务
				</view>
				<view class="action " :class="PageCur=='my'?'text-cyan':''" @click="NavChange" data-cur="my">
					<view class="cuIcon-cu-image">
						<image :src="PageCur=='my'?'/static/icon/my2.png':'/static/icon/my1.png'"></image>
					</view>
					我的
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import head1 from "../../common/head/head.vue"
	export default {
		components: {
			head1,
		},
		data() {
			return {
				PageCur: 'home',
				showBack: true,
				demo: {
					top: 0,
					height: 0
				},
				title: "川建宝",
				labelList: {
					currentPage: '1',
					pageSize: '10',
					column: "f72655cb-4cfd-11ec-9573-5254003b9aa7"
				}

			}
		},
		computed: {
			userid() {
				return this.$store.state.userId
			},
			newCity() {
				return this.$store.state.city
			}

		},
		watch: {
			"$store.state.newCity"() {
				this.city = this.$store.state.newCity
			}

		},
		onLoad(options) {
			if (options.PageCur != '') {
				this.PageCur = options.PageCur
			}

		},

		created() {
			let _this = this
			// var _this = this;
			//获取胶囊按钮的数据
			const demo = uni.getMenuButtonBoundingClientRect()
			_this.demo.top = demo.top
			_this.demo.height = demo.height
			setTimeout(() => {
				_this.$refs.homeMethod.loadingInitData()
			}, 1000)
			// this.$refs.homeMethod.getNewLabel()
			// this.$refs.homeMethod.getNewList()


		},
		onShow() {
			let that = this
			let _unionId = uni.getStorageSync('unionId')
			uni.request({
				url: 'https://www.chuanjianbao.com/ent/open/check/subscribe',
				data: {
					unionId: _unionId
				},
				success(res) {
					if (res.data.code == 0) {
						// 未关注显示
						that.$store.commit('newGZH', true)
					} else {
						that.$store.commit('newGZH', false)
					}
					// that.showErweima = res.data.code
				}
			})

		},
		onReady() {
			// this.$store.dispatch('getCity')
		},

		methods: {

			// 分享给朋友
			onShareAppMessage: function() {

				return {

					title: '四川建筑人的安全管家、服务管家',

					path: '/pages/home/home',

					imageUrl: '../../static/icon/zhengshujiankong.png'

				}

			},
			// 分享朋友圈
			onShareTimeline: function() {

				return {

					title: '四川建筑人的安全管家、服务管家，帮助您实时了解证书动态，招聘求职、法律咨询、继续教育一网打尽',

					query: 'from=pyq',

					imageUrl: '自定义图片路径'

				}

			},
			isOfficialShowChange(curVal, oldVal) {},
			// 强制刷新、重新加载页面
			test() {
				this.$forceUpdate()
			},

			NavChange: function(e) {
				this.PageCur = e.currentTarget.dataset.cur
				this.$store.commit('changePageCur', this.PageCur)
				switch (this.$store.state.PageCur) {
					case 'home':
						this.title = '川建宝';
						break;
					case 'server':
						this.title = '服务';
						break;
					case 'zhaopin1':
						this.title = '招聘';
						break;
					case 'join':
						this.title = '发布';
						break;
				}
			},
		}

	}
</script>

<style lang="scss" scoped>
	.home_page {
		padding-bottom: 100rpx;
		box-sizing: border-box;
		height: 100%;
		background: #f7f7f7;
	}

	.nav_top {
		position: fixed;
		top: 0;
		z-index: 999;
		background: #eeeeef;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		min-width: 750rpx;
	}

	body {
		font-size: 28upx;
		color: #333333;
		padding-bottom: 112upx;
		font-family: Helvetica Neue, Helvetica, sans-serif;
	}

	view,
	scroll-view,
	swiper,
	button,
	input,
	textarea,
	label,
	navigator,
	image {
		box-sizing: border-box;
	}

	.round {
		border-radius: 5000upx;
	}

	.radius {
		border-radius: 6upx;
	}

	.bg-red {
		/* background-color: #e54d42; */
		color: #ffffff;
	}

	.bg-orange {
		background-color: #f37b1d;
		color: #ffffff;
	}

	.bg-yellow {
		background-color: #fbbd08;
		color: #333333;
	}

	.bg-olive {
		background-color: #8dc63f;
		color: #ffffff;
	}

	.bg-green {
		background-color: #39b54a;
		color: #ffffff;
	}

	.bg-cyan {
		background-color: #1cbbb4;
		color: #ffffff;
	}

	.bg-blue {
		background-color: #0081ff;
		color: #ffffff;
	}


	.bg-grey {
		background-color: #8799a3;
		color: #ffffff;
	}

	.bg-gray {
		background-color: #f0f0f0;
		color: #333333;
	}

	.bg-black {
		background-color: #333333;
		color: #ffffff;
	}

	.bg-white {
		/* color: #666666; */
	}

	.text-cyan,
	.line-cyan,
	.lines-cyan {
		color: #1cbbb4;
	}

	/* ==================
	         操作条
	==================== */

	.cu-bar {
		display: flex;
		position: relative;
		align-items: center;
		min-height: 170upx;
		justify-content: space-between;
	}

	.cu-bar .action {
		display: flex;
		align-items: center;
		height: 100%;
		justify-content: center;
		max-width: 100%;
	}

	.cu-bar .action.border-title {
		position: relative;
		top: -10upx;
	}

	.cu-bar .action.border-title text[class*="bg-"]:last-child {
		position: absolute;
		bottom: -0.5rem;
		min-width: 2rem;
		height: 6upx;
		left: 0;
	}

	.cu-bar .action.sub-title {
		position: relative;
		top: -0.2rem;
	}

	.cu-bar .action.sub-title text {
		position: relative;
		z-index: 1;
	}

	.cu-bar .action.sub-title text[class*="bg-"]:last-child {
		position: absolute;
		display: inline-block;
		bottom: -0.2rem;
		border-radius: 6upx;
		width: 100%;
		height: 0.6rem;
		left: 0.6rem;
		opacity: 0.3;
		z-index: 0;
	}

	.cu-bar .action.sub-title text[class*="text-"]:last-child {
		position: absolute;
		display: inline-block;
		bottom: -0.7rem;
		left: 0.5rem;
		opacity: 0.2;
		z-index: 0;
		text-align: right;
		font-weight: 900;
		font-size: 36upx;
	}

	.cu-bar.justify-center .action.border-title text:last-child,
	.cu-bar.justify-center .action.sub-title text:last-child {
		left: 0;
		right: 0;
		margin: auto;
		text-align: center;
	}

	.cu-bar .action:first-child {
		margin-left: 30upx;
		font-size: 30upx;
	}

	.cu-bar .action text.text-cut {
		text-align: left;
		width: 100%;
	}

	.cu-bar .cu-avatar:first-child {
		margin-left: 20upx;
	}

	.cu-bar .action:first-child>text[class*="cuIcon-"] {
		margin-left: -0.3em;
		margin-right: 0.3em;
	}

	.cu-bar .action:last-child {
		margin-right: 30upx;
	}

	.cu-bar .action>text[class*="cuIcon-"],
	.cu-bar .action>view[class*="cuIcon-"] {
		font-size: 36upx;
	}

	.cu-bar .action>text[class*="cuIcon-"]+text[class*="cuIcon-"] {
		margin-left: 0.5em;
	}

	.cu-bar .content {
		position: absolute;
		text-align: center;
		width: calc(100% - 340upx);
		left: 0;
		right: 0;
		bottom: 0;
		top: 0;
		margin: auto;
		height: 60upx;
		font-size: 32upx;
		line-height: 60upx;
		cursor: none;
		pointer-events: none;
		text-overflow: ellipsis;
		white-space: nowrap;
		overflow: hidden;
	}

	.cu-bar.ios .content {
		bottom: 7px;
		height: 30px;
		font-size: 32upx;
		line-height: 30px;
	}

	.cu-bar.btn-group {
		justify-content: space-around;
	}

	.cu-bar.btn-group button {
		padding: 20upx 32upx;
	}

	.cu-bar.btn-group button {
		flex: 1;
		margin: 0 20upx;
		max-width: 50%;
	}

	.cu-bar .search-form {
		background-color: #f5f5f5;
		line-height: 64upx;
		height: 64upx;
		font-size: 24upx;
		color: #333333;
		flex: 1;
		display: flex;
		align-items: center;
		margin: 0 30upx;
	}

	.cu-bar .search-form+.action {
		margin-right: 30upx;
	}

	.cu-bar .search-form input {
		flex: 1;
		padding-right: 30upx;
		height: 64upx;
		line-height: 64upx;
		font-size: 26upx;
		background-color: transparent;
	}

	.cu-bar .search-form [class*="cuIcon-"] {
		margin: 0 0.5em 0 0.8em;
	}

	.cu-bar .search-form [class*="cuIcon-"]::before {
		top: 0upx;
	}

	.cu-bar.fixed,
	.nav.fixed {
		position: fixed;
		width: 100%;
		top: 0;
		z-index: 1024;
		box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1);
	}

	.cu-bar.foot {
		position: fixed;
		width: 100%;
		z-index: 1024;
		/* box-shadow: 0 -1upx 6upx rgba(0, 0, 0, 0.1); */
	}

	.cu-bar.tabbar {
		background-image: url('../../static/icon/bg.png');
		padding: 0;
		height: calc(100upx + env(safe-area-inset-bottom) / 2);
		padding-bottom: calc(env(safe-area-inset-bottom) / 2);
	}

	.cu-tabbar-height {
		min-height: 100upx;
		height: calc(100upx + env(safe-area-inset-bottom) / 2);
	}

	/* 	.cu-bar.tabbar.shadow {
		box-shadow: 0 -1upx 6upx rgba(0, 0, 0, 0.1);
	} */

	.cu-bar.tabbar .action {
		font-size: 22upx;
		position: relative;
		flex: 1;
		text-align: center;
		padding: 0;
		display: block;
		height: auto;
		line-height: 1;
		margin: 0;
		overflow: initial;
		margin-top: 20rpx;
	}

	.cu-bar.tabbar.shop .action {
		width: 140upx;
		flex: initial;
	}

	.cu-bar.tabbar .action.add-action {
		position: relative;
		z-index: 2;
		padding-top: 50upx;
	}

	.cu-bar.tabbar .action.add-action [class*="cuIcon-"] {
		position: absolute;
		width: 86upx;
		z-index: 2;
		height: 86upx;
		border-radius: 50%;
		line-height: 70upx;
		font-size: 50upx;
		top: -24upx;
		left: 0;
		right: 0;
		margin: auto;
		padding: 0;
	}



	.cu-bar.tabbar .action.add-action::before {
		content: "";
		position: absolute;
		width: 100upx;
		height: 30upx;
		bottom: 30upx;
		left: 0;
		right: 0;
		margin: auto;
		z-index: 1;
	}

	.cu-bar.tabbar .btn-group {
		flex: 1;
		display: flex;
		justify-content: space-around;
		align-items: center;
		padding: 0 10upx;
	}



	.cu-bar.tabbar .action [class*="cuIcon-"] {
		width: 100upx;
		position: relative;
		display: block;
		height: auto;
		margin: 0 auto 10upx;
		text-align: center;
		font-size: 40upx;
	}

	.cu-bar.tabbar .action .cuIcon-cu-image {
		margin: 0 auto;
	}

	.cu-bar.tabbar .action .cuIcon-cu-image image {
		width: 36upx;
		height: 36upx;
		display: inline-block;
	}

	.cu-bar.tabbar .submit {
		align-items: center;
		display: flex;
		justify-content: center;
		text-align: center;
		position: relative;
		flex: 2;
		align-self: stretch;
	}

	.cu-bar.tabbar .submit:last-child {
		flex: 2.6;
	}

	.cu-bar.tabbar .submit+.submit {
		flex: 2;
	}

	.cu-bar.tabbar.border .action::before {
		content: " ";
		width: 200%;
		height: 200%;
		position: absolute;
		top: 0;
		left: 0;
		transform: scale(0.5);
		transform-origin: 0 0;
		border-right: 1upx solid rgba(0, 0, 0, 0.1);
		z-index: 3;
	}

	.cu-bar.tabbar.border .action:last-child:before {
		display: none;
	}

	.cu-bar.input {
		padding-right: 20upx;
		background-color: #ffffff;
	}

	.cu-bar.input input {
		overflow: initial;
		line-height: 64upx;
		height: 64upx;
		min-height: 64upx;
		flex: 1;
		font-size: 30upx;
		margin: 0 20upx;
	}

	.cu-bar.input .action {
		margin-left: 20upx;
	}

	.cu-bar.input .action [class*="cuIcon-"] {
		font-size: 48upx;
	}

	.cu-bar.input input+.action {
		margin-right: 20upx;
		margin-left: 0upx;
	}

	.cu-bar.input .action:first-child [class*="cuIcon-"] {
		margin-left: 0upx;
	}

	.bar_main {
		background-image: url(../../static/icon/navbg.png);
		background-size: 100% 100% !important;
		background-repeat: no-repeat !important;
		background-position-y: -8rpx !important;
		/* height: 118rpx !important; */
		position: relative;
	}

	.add_show {
		position: relative;
	}



	.official {
		position: relative;
	}

	.movable-area {
		pointer-events: none;
		/* 这个属性设置为none,让所有事件穿透过去 */
		z-index: 100;
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
	}

	.movable-view {
		pointer-events: auto;
		/* 重设为auto,覆盖父属性设置 */
		height: 100rpx;
		width: 120rpx;
		/* background: red; */
	}

	.xf-text {
		font-size: 12px;
		color: #ffffff;
		margin-top: 10rpx;
		width: 100rpx;
		height: 100rpx;
		background: #25dfda78;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 50%;
	}

	.xf_button {
		background-color: rgba(255, 255, 255, 0);
		border: 0px;
		height: 100rpx;
		top: 70%;
		right: 0;
		bottom: 20rpx;
		position: fixed;
		display: flex;
		flex-direction: column;
	}

	.xf_button::after {
		border: 0px;
	}

	.xf_image {
		z-index: 5;
		width: 100rpx;
		height: 100rpx;
	}
</style>
